import xlrd

data = xlrd.open_workbook('到达率曲线.xls')
table = data.sheet_by_name('Sheet1')

def getCell(x,y):
    return table.cell(x, y).value

x=[]
y=[]
for i in range(24):
    x.append(int(getCell(i, 0)))
    y.append(float(getCell(i, 1)))

import pltHelp
import matplotlib.pyplot as plt
plt.plot(x, y, ms=10)
pltHelp.show('时间','到达率')

# 计算面积
lastX=x[0]
lastY=y[0]
s=0
for i in range(1,24):
    s+=(lastY+y[i])*(x[i]-lastX)/2
    lastX=x[i]
    lastY=y[i]
print(s)